{layout name="/base"}
  <div id="page-wrapper">
    <div class="row">
      <div class="col-lg-12">
        <h1>旅行币管理 <small>旅行币信息列表</small></h1>
        <ol class="breadcrumb">
          <li><a href="index.php"><i class="fa fa-dashboard"></i> 管理首页</a></li>
          <li class="active"><i class="fa fa-table"></i> 旅行币信息列表</li>
        </ol>
        <div class="alert alert-success alert-dismissable">
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
          这里查看会员旅行币信息 
        </div>
      </div>
    </div>
    <!-- /.row -->
    <div class="row">
      <div class="col-lg-12">
        <div class="col-lg-12">
        <form class="form-horizontal" role="form" action="/intergrates" method="get">
          <div class="form-group col-sm-2" style="margin-right:10px;">
            <label for="">选择分公司</label>
            <select class="form-control" name="branch" id="branch">
              <option value="">全部</option>
              {foreach $filiales as $key=>$value}
              {if($key == input('get.branch'))}
              <option selected value="{$key}">{$value}</option>
              {else/}
              <option  value="{$key}">{$value}</option>
              {/if}
              {/foreach}
            </select>
          </div>
          
          <div class="form-group col-sm-2"  style="margin-right:10px;">
            <label for="">请选择营地</label>
            <select id="camps_id" class="form-control" name="camp_id">
              <option value="">全部</option>
            </select>
          </div>
          
          <div class="form-group col-sm-2 input-group"  style="margin-right:10px;">
            <label for="">请选择搜索条件</label>
            <select class="form-control" name="searchfield">
            	<option value="">请选择搜索条件</option>
              <option value="type">类型</option>
              <option value="intergrate">旅行币</option>
            </select>
          </div>
          
           <div class="form-group col-sm-2 input-group"  style="margin-right:10px;">  
            <label for="">请输入关键字</label>
            {if (input('get.keyword'))}
            <input class="form-control" type="text"  value="{:input('get.keyword')}" name="keyword">
            {else /}
            <input class="form-control" type="text"  placeholder="请输入营地信息搜索" name="keyword">
            {/if}
            <label for="">&nbsp;</label>
            <span class="input-group-btn">
              <button class="btn btn-default" type="submit">搜索</button>
            </span>
          </div>
        </form>
      </div>
        <div class="table-responsive">
          <table class="table table-bordered table-hover table-striped tablesorter">
            <thead>
              <tr>
                <th>时间</th>
                <th>类型</th>
                <th>旅行币</th>
                <th>会员账号</th>
                <th>所属营地</th>
                <th>备注</th>
              </tr>
            </thead>
            <tbody>
            {volist name='list' id='vo'}
              <tr>
                <td>{$vo.created_at}</td>
                <td>{$vo.type}</td>
                <td>{$vo.intergrate}</td>
                <td>{$vo->getUserAccout($vo.user_id)}</td>
                <td>{$vo.camps.name}</td>
                <td>{$vo.remark}</td>
              </tr>
            {/volist}
            </tbody>
          </table>
        </div> 
      </div>
     {$list->render()}
    </div>
    <!-- /.row -->
  </div><!-- /#page-wrapper -->
	<script type="text/javascript">
    function init(c) {	
      $.post("/ajax/campslist",
        {
          branch_id:$("#branch").children('option:selected').val()
        },
        function(data,status){
          var optionstring = "";   
          $.each(data,function(id,name){    
             //输出
             if (id == c) {
              optionstring += "<option selected value=\"" + id + "\" >" + name + "</option>"; 
             }else{
              optionstring += "<option value=\"" + id + "\" >" + name + "</option>"; 
             }
          })
          $("#camps_id").html("<option value=''>请选择...</option> "+optionstring);
        });
    };
    init({:input('get.services')});
    $("#branch").change(function(){
      init();
      });
</script>

